package smedi.ismedi.web.bff.controller.report;


import com.smedi.ismedi.report.api.feign.RemoteReportPalnApi;
import com.smedi.ismedi.report.api.feign.RemoteReportPalnJobAgainApi;
import com.smedi.ismedi.report.api.model.dto.ReportPalnDto;
import com.smedi.ismedi.report.api.model.vo.LabelAndValue;
import com.smedi.ismedi.report.api.model.vo.NoticeVo;
import com.smedi.ismedi.report.api.model.vo.PalnAgainVO;
import com.smedi.ismedi.report.api.model.vo.ReportPalnVo;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping(value = "/webbff/v1/plan")
@RestController
@Api(tags = {"填报计划"})
public class RemoteReportPalnController {


    @Autowired
    private  RemoteReportPalnApi remoteReportPalnApi;




    @ApiOperation( value = "查询",nickname = "查询" )
    @PostMapping({"list"})
    ResponseData<PaginationData<ReportPalnVo>> getList(@RequestBody(required = false) ReportPalnDto reportPalnDto){

        return  remoteReportPalnApi.getList(reportPalnDto);

    }

    @ApiOperation(value = "新增",nickname = "新增" )
    @PostMapping({"add"})
    ResponseData<String> add(@ApiParam(name = "填报计划详情",value = "传入json格式",required = true)  @RequestBody ReportPalnVo reportPalnVo){

        return remoteReportPalnApi.add(reportPalnVo);
    }

    @ApiOperation(value = "编辑填报计划", nickname = "编辑填报计划")
    @PostMapping({"edit"})
    ResponseData<String> edit(@RequestBody ReportPalnVo reportPalnVo){


        return  remoteReportPalnApi.edit(reportPalnVo);
    }

    @ApiOperation(value = "删除填报计划",nickname = "删除填报计划")
    @DeleteMapping("/delete/{planIds}")
    ResponseData<String> delete(@PathVariable("planIds") Integer[] planId){

        return remoteReportPalnApi.delete(planId);

    }
    @GetMapping({"reportType"})
    ResponseData<List<LabelAndValue>> reportType(){
        return remoteReportPalnApi.reportType();
    }



    @ApiOperation(value = "通知辅助接口", nickname = "通知辅助接口")
    @GetMapping("/notice/{taskId}")
    public ResponseData<NoticeVo> notice(@PathVariable("taskId") Long taskId){
        return remoteReportPalnApi.notice(taskId);
    }

    @Autowired
    private RemoteReportPalnJobAgainApi palnJobAgain;



    @ApiOperation(value = "补发", nickname = "补发")
    @GetMapping("/again")
    public ResponseData<List<PalnAgainVO>> againHand() {
        return palnJobAgain.againHand();
    }
}
